package cn.tedu._05article_test.base.config;

import cn.tedu._05article_test.base.interceptors.LoginCheckInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@Slf4j
public class InterceptorConfig implements WebMvcConfigurer {
    //访问时间限定的拦截器     注册拦截器，弄完必须注册一下才能用
    @ExceptionHandler
    public void addInterceptors(InterceptorRegistry registry) {
        log.debug("开始注册拦截器");
        registry.addInterceptor(new LoginCheckInterceptor())
                .addPathPatterns("/v1/user/article");
    }


}
